From: Khalid Abu Shawarib Date: Tue, 2 Sep 2025 22:21:00 +0000 (+0300) Subject: search: Use a variable for tracking allocated width X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~88^2~9^2^2~5 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=3558da9d46b6edb5df2aee6e3218ae07e261df18;p=gnome-shell.git search: Use a variable for tracking allocated width Instead of the x coordinates of the allocation box. Part-of: (cherry picked from commit 1e53578362ab7e0575bfa37788f20deabecf8e7f) --- diff --git a/js/ui/search.js b/js/ui/search.js index 9b513136d..620ad3ddb 100644 --- a/js/ui/search.js +++ b/js/ui/search.js @@ -399,8 +399,7 @@ const GridSearchResultsLayout = GObject.registerClass({ const width = box.get_width(); const childBox = new Clutter.ActorBox(); - childBox.x1 = 0; - childBox.y1 = 0; + let accumulatedWidth = 0; let first = true; for (let child of container) { @@ -410,20 +409,21 @@ const GridSearchResultsLayout = GObject.registerClass({ if (first) first = false; else - childBox.x1 += this._spacing; + accumulatedWidth += this._spacing; const [childWidth] = child.get_preferred_width(-1); const [childHeight] = child.get_preferred_height(-1); - if (childBox.x1 + childWidth <= width) + childBox.set_origin(accumulatedWidth, 0); + accumulatedWidth += childWidth; + + if (accumulatedWidth <= width) childBox.set_size(childWidth, childHeight); else childBox.set_size(0, 0); child.allocate(childBox); child.can_focus = childBox.get_area() > 0; - - childBox.x1 += childWidth; } }